﻿using BLL;
using Config;
using gfLibrary;
using IYAKASAPortal.Services;
using Model;
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data.SqlClient;
using System.IO;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;


namespace IYAKASAPortal.PrintAll
{
    public partial class ZJdetails : System.Web.UI.Page
    {  
        private UserInfo userInfo { get; set; }
        private static string jclsh { get; set; }
        private static string jclshu { get; set; }

        private string  qualified = "1";
        private string  unqualified = "2";
        private string  notdetected = "0";
        private string  nonjudgment = "3";

        protected void Page_Load(object sender, EventArgs e)
        {
            //if (Session["UserName"] != null && Session["UserName"].ToString() != "")
            //{
            //    string userName = Session["UserName"].ToString();
            //    userInfo = IYAKASAPortal.Services.UserAuthority.GetUserAuthority(userName);
            //}
            //else
            //{
            //    gfJs.RunFunction(this.Page, "parent.window.location = '../logout.aspx';");
            //}

            //if (Request["UniqueKey"] != null && Request["UniqueKey"].ToString() != "")
            //{
                if (!IsPostBack)
                {
                    TextBoxAVG.Attributes.Add("readonly", "true");
                    this.GetData(Request["UniqueKey"].ToString());
                    //this.GetData("170");  
                }

            //}
            //else
            //{
            //    gfJs.RunFunction(this.Page, "parent.window.location = '../logout.aspx';");
            //}
            
          

        }
        //Get all jclsh
        private List<string> GetAllJCLSH(string strJCLSH)
        {
            List<string> lstJCLSH = new List<string>();
            if (strJCLSH.Contains("-"))
            {
                string[] strInfos = strJCLSH.Split('-');
                int iJCCS = Convert.ToInt32(strInfos[1]) + 1;
                for (int i = 1; i < iJCCS; i++)
                {
                    lstJCLSH.Add(strInfos[0] + "-" + i.ToString("d2"));
                }
            }
            else
            {
                lstJCLSH.Add(strJCLSH);
            }

            return lstJCLSH;
        }

        private void GetData(string id)
        {

            GetbasicData(id);
            GetbasicPlusData(id);
            GetbrakingData();
            GetDPCGData();
            GetZYJSData();
            GetLamplightData();
            GetXJDate();
            GetSDSData();
            GetWTGKData();
            GetSTGKData();
            GetGXSData();
            GetQTData();
            GetDPBHGData();
        }

        #region 绑定信息
        //获取基础信息并赋给文本框
        private void GetbasicData(string key)
        {
            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            var infobll = bll.GetModelList("ID=" + key);

            for (int i = 0; i < infobll.Length; i++)
            {
               Session["jclsh"]  = infobll[i].JCLSH;
               jclsh = infobll[i].JCLSH;
                //基本信息
                TextBoxCZDW.Text = infobll[i].SYR;
                TextBoxCPHM.Text = infobll[i].HPHM;
                TextBoxFDJH.Text = infobll[i].FDJH;
                TextBoxCLLB.Text = infobll[i].CLZL;
                TextBoxZZL.Text = infobll[i].HDZH;
                TextBoxZWS.Text = infobll[i].CYS;

                TextBoxSJDW.Text = infobll[i].SJDW;
                TextBoxYYZH.Text = infobll[i].YYZH;
                TextBoxCJHM.Text = infobll[i].VIN;
                TextBoxCP.Text = infobll[i].PP;
                TextBoxXH.Text = infobll[i].XH;

                TextBoxRHRQ.Text = infobll[i].CCDJRQ;
                TextBoxCJRQ.Text = infobll[i].JCRQ;
                TextBoxRL.Text = infobll[i].RLLB;
                TextBoxJYY1.Text = infobll[i].YCY;
                TextBoxJYY2.Text = infobll[i].DLY;

                TextBoxDPRY.Text = infobll[i].DPJYY;


            }
        }
        //获取报告单信息
        private void GetbasicPlusData(string key)
        {
            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            CONST_DEFINE_BLL c_bll = new CONST_DEFINE_BLL();
            var infobll = bll.GetModelList("ID=" + key);
            ListItem item;
            var hpzl = c_bll.GetModelList("CON_CHNAME='HPZL' and CON_CODE<>15  order by CON_ORDER asc");
            foreach (var v in hpzl)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpHPZL.Items.Add(item);
            }
            var csys = c_bll.GetModelList("CON_CHNAME='CSYS' order by CON_ORDER asc");
            foreach (var v in csys)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpCSYS.Items.Add(item);
            }
            var zxzxjxs = c_bll.GetModelList("CON_CHNAME='ZXZXJXS' order by CON_ORDER asc");
            foreach (var v in zxzxjxs)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpZXZXJXS.Items.Add(item);
            }
            var qzdz = c_bll.GetModelList("CON_CHNAME='QZDZ' and CON_CODE<>1 order by CON_ORDER asc");
            foreach (var v in qzdz)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpQZDZ.Items.Add(item);
            }
            var yggsnfkt = c_bll.GetModelList("CON_CHNAME='YGGSNFKT' order by CON_ORDER asc");
            foreach (var v in yggsnfkt)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpYGGSNFKT.Items.Add(item);
            }
            var qdxs = c_bll.GetModelList("CON_CHNAME='QDXS' order by CON_ORDER asc");
            foreach (var v in qdxs)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpQDXS.Items.Add(item);
            }
            var rllb = c_bll.GetModelList("CON_CHNAME='RLLB' order by CON_ORDER asc");
            foreach (var v in rllb)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpRLLB.Items.Add(item);
            }
            var kclxdj = c_bll.GetModelList("CON_CHNAME='KCLXDJ' order by CON_ORDER asc");
            foreach (var v in kclxdj)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpKCLXDJ.Items.Add(item);
            }
            var ltgglx = c_bll.GetModelList("CON_CHNAME='LTGGLX' order by CON_ORDER asc");
            foreach (var v in ltgglx)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpLTGGLX.Items.Add(item);
            }
            var bzzxs = c_bll.GetModelList("CON_CHNAME='BZZXS' order by CON_ORDER asc");
            foreach (var v in bzzxs)
            {
                item = new ListItem();
                item.Text = v.CON_CON;
                item.Value = v.CON_CODE;
                drpBZZXS.Items.Add(item);
            }
            for (int i = 0; i < infobll.Length; i++)
            {
                Session["jclsh"] = infobll[i].JCLSH;
                jclsh = infobll[i].JCLSH;
                //1
                TextBoxHPHM.Text = infobll[i].HPHM;
                //TextBoxHPZL.Text = infobll[i].HPZL;
                drpHPZL.SelectedValue = infobll[i].HPZLDH;
                TextBoxGCPZH.Text = infobll[i].GCPZH;
                TextBoxGCLX.Text = infobll[i].GCLX;
                TextBoxCLCCRQ.Text = Convert.ToDateTime(infobll[i].CCRQ).ToString("yyyy-MM-dd");

                //2
                TextBoxZCDJRQ.Text = infobll[i].CCDJRQ;
                TextBoxVIN.Text = infobll[i].VIN;
                TextBoxCLXH.Text = infobll[i].XH;
                TextBoxFDJ.Text = infobll[i].FDJH;
                drpCSYS.SelectedItem.Text= infobll[i].CSYS;

                //3
                TextBoxXSLC.Text = infobll[i].LJXSLC;
                //TextBoxCDXS.Text = infobll[i].QDXS;
                drpQDXS.SelectedValue = infobll[i].QDXSDH;
                //TextBoxXJXS.Text = infobll[i].ZXZXJXS;
                drpZXZXJXS.SelectedValue = infobll[i].ZXZXJXSDH;
                TextBoxGCZS.Text = infobll[i].ZZS;
                TextBoxYRGL.Text = infobll[i].EDGL;

                //4
                TextBoxNJ.Text = infobll[i].EDNJ;
                TextBoxZS.Text = infobll[i].EDNJZS;
                //TextBoxRLLB.Text = infobll[i].RLLB;
                drpRLLB.SelectedValue = infobll[i].RLLBDH;
                //TextBoxQDLT.Text = infobll[i].LTGGLX;
                drpLTGGLX.SelectedValue = infobll[i].LTGGLXDH;
                TextBoxCZZL.Text = infobll[i].ZZL;
                TextBoxCLCG.Text = infobll[i].CSG;

                //5
                TextBoxQLJ.Text = infobll[i].LZLJ;
                TextBoxKCCC.Text = infobll[i].CSC;
                //TextBoxKCDJ.Text = infobll[i].KCLXDJ;
                drpKCLXDJ.SelectedItem.Text = infobll[i].KCLXDJ;
                TextBoxHCCS.Text = infobll[i].HCCSXS;
                TextBoxQDZS.Text = infobll[i].QDZWZ;
                if (!string.IsNullOrEmpty(infobll[0].QDZWZ))
                {
                    string strQDZWZ = infobll[0].QDZWZ;
                    strQDZWZ = strQDZWZ.Substring(0, strQDZWZ.Length - 1);

                    if (strQDZWZ.Contains(','))
                    {
                        LabelQDZS.Text = "(轴数:" + strQDZWZ.Split(',').Length.ToString() + ")";
                    }
                    else
                    {
                        LabelQDZS.Text = "(轴数:1)";
                    }
                }


                //6
                TextBoxQDZL.Text = infobll[i].QDZKZZL;
                if (!string.IsNullOrEmpty(infobll[i].CLZLDH))
                {
                    string qyc = infobll[i].CLZLDH.Substring(0, 1);
                    if (qyc == "G")
                    {
                        TextBoxQYZL.Text = infobll[i].ZBZL;
                    }
                }
                //TextBoxBZZ.Text = infobll[i].BZZXS;
                drpBZZXS.SelectedValue = infobll[i].BZZXSDH;
                TextBoxZXZS.Text = infobll[i].ZXZLXDH;
                //TextBoxQZDZ.Text = infobll[i].QZDZ;
                drpQZDZ.SelectedValue = infobll[i].QZDZDH;

                //7
                TextBoxKCZW.Text = infobll[i].CYS;
                TextBoxDCZS.Text = infobll[i].ZZS;
                TextBoxDC1.Text = infobll[i].CSC;
                TextBoxDC2.Text = infobll[i].CSK;
                TextBoxDC3.Text = infobll[i].CSG;
                TextBoxGC1.Text = infobll[i].GCCSC;
                TextBoxGC2.Text = infobll[i].GCCSK;
                TextBoxGC3.Text = infobll[i].GCCSG;

                //8
                //TextBoxYGTZ.Text = infobll[i].YGGSNFKT;
                drpYGGSNFKT.SelectedValue = infobll[i].YGGSNFKTDH;
                string strZCZWZ = infobll[i].ZCZWZ;
                if (string.IsNullOrEmpty(strZCZWZ) == false)
                {
                    TextBoxZCZ.Text = strZCZWZ.Substring(0, strZCZWZ.Length - 1);
                }
                TextBoxCXLBGDDC.Text = infobll[i].ZCLBGD;
                TextBoxCXLBGDGC.Text = infobll[i].GCLBGD;
            }
        }
        //获取制动信息并赋给文本框
        private void GetbrakingData()
        {
            RESULT_BRAKE_BLL bll = new RESULT_BRAKE_BLL();
            var lstJCLSH = GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    #region 轴
                    //1轴
                    TextBox1lhL.Text = infobll[i].YZZLZ;
                    TextBox1lhR.Text = infobll[i].YZYLZ;
                    TextBox1zdlL.Text = infobll[i].YZZZDZDL;
                    TextBox1zdlR.Text = infobll[i].YZYZDZDL;
                    TextBox1gccL.Text = infobll[i].YZZZDCZD;
                    TextBox1gccR.Text = infobll[i].YZYZDCZD;
                    TextBox1zcL.Text = infobll[i].YZZSZDL;
                    TextBox1zcR.Text = infobll[i].YZYSZDL;
                    TextBox1zzlL.Text = infobll[i].YZZZZL;
                    TextBox1zzlR.Text = infobll[i].YZYZZL;
                    TextBox1zzlvL.Text = infobll[i].YZZZZLV;
                    TextBox1zzlvR.Text = infobll[i].YZYZZLV;
                    TextBox1BPH.Text = infobll[i].YZBPHLV;
                    TextBox1ZDL.Text = infobll[i].YZZDLV;


                    //二轴
                    TextBox2lhL.Text = infobll[i].EZZLZ;
                    TextBox2lhR.Text = infobll[i].EZYLZ;
                    TextBox2zdlL.Text = infobll[i].EZZZDZDL;
                    TextBox2zdlR.Text = infobll[i].EZYZDZDL;
                    TextBox2gccL.Text = infobll[i].EZZZDCZD;
                    TextBox2gccR.Text = infobll[i].EZYZDCZD;
                    TextBox2zcL.Text = infobll[i].EZZSZDL;
                    TextBox2zcR.Text = infobll[i].EZYSZDL;
                    TextBox2zzlL.Text = infobll[i].EZZZZL;
                    TextBox2zzlR.Text = infobll[i].EZYZZL;
                    TextBox2zzlvL.Text = infobll[i].EZZZZLV;
                    TextBox2zzlvR.Text = infobll[i].EZYZZLV;
                    TextBox2BPH.Text = infobll[i].EZBPHLV;
                    TextBox2ZDL.Text = infobll[i].EZZDLV;

                    //三轴
                    TextBox3lhL.Text = infobll[i].SZZLZ;
                    TextBox3lhR.Text = infobll[i].SZYLZ;
                    TextBox3zdlL.Text = infobll[i].SZZZDZDL;
                    TextBox3zdlR.Text = infobll[i].SZYZDZDL;
                    TextBox3gccL.Text = infobll[i].SZZZDCZD;
                    TextBox3gccR.Text = infobll[i].SZZZDCZD;
                    TextBox3zcL.Text = infobll[i].SZZSZDL;
                    TextBox3zcR.Text = infobll[i].SZYSZDL;
                    TextBox3zzlL.Text = infobll[i].SZZZZL;
                    TextBox3zzlR.Text = infobll[i].SZYZZL;
                    TextBox3zzlvL.Text = infobll[i].SZZZZLV;
                    TextBox3zzlvR.Text = infobll[i].SZYZZLV;
                    TextBox3BPH.Text = infobll[i].SZBPHLV;
                    TextBox3ZDL.Text = infobll[i].SZZDLV;
                    //四轴
                    TextBox4lhL.Text = infobll[i].SIZZLZ;
                    TextBox4lhR.Text = infobll[i].SIZYLZ;
                    TextBox4zdlL.Text = infobll[i].SIZZZDZDL;
                    TextBox4zdlR.Text = infobll[i].SIZYZDZDL;
                    TextBox4gccL.Text = infobll[i].SIZZZDCZD;
                    TextBox4gccR.Text = infobll[i].SIZZZDCZD;
                    TextBox4zcL.Text = infobll[i].SIZZSZDL;
                    TextBox4zcR.Text = infobll[i].SIZYSZDL;
                    TextBox4zzlL.Text = infobll[i].SIZZZZL;
                    TextBox4zzlR.Text = infobll[i].SIZYZZL;
                    TextBox4zzlvL.Text = infobll[i].SIZZZZLV;
                    TextBox4zzlvR.Text = infobll[i].SIZYZZLV;
                    TextBox4BPH.Text = infobll[i].SIZBPHLV;
                    TextBox4ZDL.Text = infobll[i].SIZZDLV;
                    //五轴
                    TextBox5lhL.Text = infobll[i].WZZLZ;
                    TextBox5lhR.Text = infobll[i].WZYLZ;
                    TextBox5zdlL.Text = infobll[i].WZZZDZDL;
                    TextBox5zdlR.Text = infobll[i].WZYZDZDL;
                    TextBox5gccL.Text = infobll[i].WZZZDCZD;
                    TextBox5gccR.Text = infobll[i].WZZZDCZD;
                    TextBox5zcL.Text = infobll[i].WZZSZDL;
                    TextBox5zcR.Text = infobll[i].WZYSZDL;
                    TextBox5zzlL.Text = infobll[i].WZZZZL;
                    TextBox5zzlR.Text = infobll[i].WZYZZL;
                    TextBox5zzlvL.Text = infobll[i].WZZZZLV;
                    TextBox5zzlvR.Text = infobll[i].WZYZZLV;
                    TextBox5BPH.Text = infobll[i].WZBPHLV;
                    TextBox5ZDL.Text = infobll[i].WZZDLV;
                    //六轴
                    TextBox6lhL.Text = infobll[i].LZZLZ;
                    TextBox6lhR.Text = infobll[i].LZYLZ;
                    TextBox6zdlL.Text = infobll[i].LZZZDZDL;
                    TextBox6zdlR.Text = infobll[i].LZYZDZDL;
                    TextBox6gccL.Text = infobll[i].LZZZDCZD;
                    TextBox6gccR.Text = infobll[i].LZZZDCZD;
                    TextBox6zcL.Text = infobll[i].LZZSZDL;
                    TextBox6zcR.Text = infobll[i].LZYSZDL;
                    TextBox6zzlL.Text = infobll[i].LZZZZL;
                    TextBox6zzlR.Text = infobll[i].LZYZZL;
                    TextBox6zzlvL.Text = infobll[i].LZZZZLV;
                    TextBox6zzlvR.Text = infobll[i].LZYZZLV;
                    TextBox6BPH.Text = infobll[i].LZBPHLV;
                    TextBox6ZDL.Text = infobll[i].LZZDLV;

                    TextBoxZCLH.Text = infobll[i].ZCZZ;
                    TextBoxZC.Text = infobll[i].EZSZDL;
                    TextBoxZCZDL.Text = infobll[i].ZCSZDLV;
                    TextBoxZHCLH.Text = infobll[i].ZCZZ;
                    TextBoxZHC.Text = infobll[i].ZCZDL;
                    TextBoxZHCZDL.Text = infobll[i].ZCZDLV;
                    #endregion

                    #region 标准
                    //获取标准
                    //阻滞率标准
                    YzzlvBZ.Value = infobll[i].YZZZLVXZBZ;
                    EzzlvBZ.Value = infobll[i].EZZZLVXZBZ;
                    SzzlvBZ.Value = infobll[i].SZZZLVXZBZ;
                    SIzzlvBZ.Value = infobll[i].SIZZZLVXZBZ;
                    WzzlvBZ.Value = infobll[i].WZZZLVXZBZ;
                    LzzlvBZ.Value = infobll[i].LZZZLVXZBZ;
                    //不平衡率标准
                    YzbphBZ.Value = infobll[i].YZBPHLVBZ;
                    EzbphBZ.Value = infobll[i].EZBPHLVBZ;
                    SzbphBZ.Value = infobll[i].SZBPHLVBZ;
                    SIzbphBZ.Value = infobll[i].SIZBPHLVBZ;
                    WzbphBZ.Value = infobll[i].WZBPHLVBZ;
                    LzbphBZ.Value = infobll[i].LZBPHLVBZ;
                    //制动率标准
                    YzzdlvBZ.Value = infobll[i].YZZDLVBZ;
                    EzzdlvBZ.Value = infobll[i].EZZDLVBZ;
                    SzzdlvBZ.Value = infobll[i].SZZDLVBZ;
                    SIzzdlvBZ.Value = infobll[i].SIZZDLVBZ;
                    WzzdlvBZ.Value = infobll[i].WZZDLVBZ;
                    LzzdlvBZ.Value = infobll[i].LZZDLVBZ;
                    ZCZDLVBZ.Value = infobll[i].SZDLVBZ;
                    ZHCZDLVBZ.Value = infobll[i].ZCZDLVBZ;
                    #endregion
                }
            }
        }

        //获取底盘测功信息
        private void GetDPCGData()
        {
            RESULT_DPCG_BLL bll = new RESULT_DPCG_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                jclshu = "";
                for (int i = 0; i < infobll.Length; i++)
                {
                    jclshu = lstJCLSH[j];
                    TextBoxNJGK.Text = infobll[i].NJGL_SCBZ;
                    TextBoxGLGK.Text = infobll[i].GLGL_SCBZ;
                    TextBoxHX.Text = infobll[i].HX_LC;
                    TextBoxDBGL.Text = infobll[i].GK_DBGL;
                    TextBoxEDCS.Text = infobll[i].GK_EDCS;
                    TextBoxJZL.Text = infobll[i].GK_JZL;
                    TextBoxWDCS.Text = infobll[i].GK_WDCS;
                    TextBoxRYJJ1.Text = infobll[i].YH_BZ;
                    TextBoxRYJJ2.Text = infobll[i].YH_SCZ;
                    rblRYJJ.SelectedValue = infobll[i].YH_PD;
                }
            }
            
        }

        //获取灯光信息
        private void GetLamplightData()
        {
            RESULT_LAMP_ZJ_BLL bll = new RESULT_LAMP_ZJ_BLL();
            var lstJCLSH = GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxZWGQ.Text = infobll[i].ZWDYGGQ;
                    TextBoxYWGQ.Text = infobll[i].YWDYGGQ;
                    TextBoxZNGQ.Text = infobll[i].ZNDYGGQ;
                    TextBoxYNGQ.Text = infobll[i].YNDYGGQ;
                    TextBoxJGZWSX.Text = infobll[i].ZWDJGCZPY;
                    TextBoxJGYWSX.Text = infobll[i].YWDJGCZPY;
                    TextBoxJGZYSP.Text = infobll[i].ZWDJGSPPYL;
                    TextBoxJGYWSP.Text = infobll[i].YWDJGSPPYL;
                    TextBoxJGZNSP.Text = infobll[i].ZNDJGSPPYL;
                    TextBoxJGYNSP.Text = infobll[i].YNDJGSPPYL;

                    TextBoxYGZWSX.Text = infobll[i].ZWDYGCZPY;
                    TextBoxYGYWSX.Text = infobll[i].YWDYGCZPY;
                    TextBoxYGZWSP.Text = infobll[i].ZWDYGSPPYL;
                    TextBoxYGYWSP.Text = infobll[i].YWDYGSPPYL;
                    TextBoxYGZNSP.Text = infobll[i].ZNDYGSPPY;
                    TextBoxYGYNSP.Text = infobll[i].YNDYGSPPY;

                    TextBoxZWPD.Text = infobll[i].ZWDZ_PD;
                    TextBoxYWPD.Text = infobll[i].YWDZ_PD;
                    TextBoxZNPD.Text = infobll[i].ZNDZ_PD;
                    TextBoxYNPD.Text = infobll[i].YNDZ_PD;

                    TextBoxGQPD.Text = infobll[i].DGZGQ_PD;
                    //获取灯光标准
                    DGGQXZ.Value = infobll[i].DGGQXZ;
                    YGCZPYXZXX.Value = infobll[i].YGCZPYXZXX;
                    YGCZPYXZSX.Value = infobll[i].YGCZPYXZSX;
                    YGZDZPXZ.Value = infobll[i].YGZDZPXZ;
                    if (infobll[i].YGZDYPXZ != "")
                        YGZDYPXZ.Value = (0 - int.Parse(infobll[i].YGZDYPXZ)).ToString();
                    else YGZDYPXZ.Value = infobll[i].YGZDYPXZ;
                    YGYDZPXZ.Value = infobll[i].YGYDZPXZ;
                    if (infobll[i].YGYDYPXZ != "")
                        YGYDYPXZ.Value = (0 - int.Parse(infobll[i].YGYDYPXZ)).ToString();
                    else YGYDYPXZ.Value = infobll[i].YGYDYPXZ;
                    JGCZPYXZXX.Value = infobll[i].JGCZPYXZXX;
                    JGCZPYXZSX.Value = infobll[i].JGCZPYXZSX;
                    JGZDZPXZ.Value = infobll[i].JGZDZPXZ;
                    if (infobll[i].JGZDYPXZ != "")
                        JGZDYPXZ.Value = (0 - int.Parse(infobll[i].JGZDYPXZ)).ToString();
                    else JGZDYPXZ.Value = infobll[i].JGZDYPXZ;
                    JGYDZPXZ.Value = infobll[i].JGYDZPXZ;
                    if (infobll[i].JGYDYPXZ != "")
                        JGYDYPXZ.Value = (0 - int.Parse(infobll[i].JGYDYPXZ)).ToString();
                    else JGYDYPXZ.Value = infobll[i].JGYDYPXZ;
                }           
            }
        }

        //获取燃油经济信息
        //private void GetRYJJData()
        //{
        //    RESULT_DPCG_BLL bll = new RESULT_DPCG_BLL();
        //    var infobll = bll.GetModelList("JCLSH= '" + jclsh + "'");
        //    for (int i = 0; i < infobll.Length; i++)
        //    {
        //        TextBoxRYJJ1.Text = infobll[i].YH_BZ;
        //        TextBoxRYJJ2.Text = infobll[i].YH_SCZ;
        //        rblRYJJ.SelectedValue = infobll[i].YH_PD;
        //    }
        //}

        //获取双怠速信息
        private void GetSDSData()
        {
            RESULT_SDS_BLL bll = new RESULT_SDS_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxGDSGKL.Text = infobll[i].GLKQXS;
                    TextBoxDSCO.Text = infobll[i].DSCO;
                    TextBoxDSHC.Text = infobll[i].DSHC;
                    TextBoxGDSCO.Text = infobll[i].GDSCO;
                    TextBoxGDSHC.Text = infobll[i].GDSHC;
                    GDSCOXZ.Value = infobll[i].GDSCOXZ;
                    GDSHCXZ.Value = infobll[i].GDSHCXZ;
                    DSCOXZ.Value = infobll[i].DSCOXZ;
                    DSHCXZ.Value = infobll[i].DSHCXZ;
                }
            }
            
        }

        //获取稳态工况信息
        private void GetWTGKData()
        {
            RESULT_ASM_BLL bll = new RESULT_ASM_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxWTGK1.Text = infobll[i].CO5025JG;
                    TextBoxWTGK2.Text = infobll[i].HC5025JG;
                    TextBoxWTGK3.Text = infobll[i].NO5025JG;
                    TextBoxWTGK4.Text = infobll[i].CO2540JG;
                    TextBoxWTGK5.Text = infobll[i].HC2540JG;
                    TextBoxWTGK6.Text = infobll[i].NO2540JG;
                    rblWTGK.SelectedValue = infobll[i].ASM_PD;
                }
            }
            
        }

        //获取瞬态工况信息
        private void GetSTGKData()
        {
            RESULT_VMAS_BLL bll = new RESULT_VMAS_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxSTGK1.Text = infobll[i].COJG;
                    TextBoxSTGK2.Text = infobll[i].HCJG;
                    TextBoxSTGK3.Text = infobll[i].NOJG;
                    TextBoxSTGK4.Text = infobll[i].HC_NOJG;
                    rblWTGK.SelectedValue = infobll[i].VMAS_PD;
                }
            }
            
        }

        //获取光系数信息
        private void GetGXSData()
        {
            RESULT_LD_BLL bll = new RESULT_LD_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxGXS1.Text = infobll[i].GXSXS80;
                    TextBoxGXS2.Text = infobll[i].GXSXS90;
                    TextBoxGXS3.Text = infobll[i].GXSXS100;
                    TextBoxGXS4.Text = infobll[i].GLJG;
                    rblWTGK.SelectedValue = infobll[i].LD_PD;
                }
            }
            
        }
        
        //获取自由加速信息
        private void GetZYJSData()
        {
            RESULT_ZYJS_BLL bll = new RESULT_ZYJS_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxONE.Text = infobll[i].ZYJSJG1;
                    TextBoxTWO.Text = infobll[i].ZYJSJG2;
                    TextBoxTHREE.Text = infobll[i].ZYJSJG3;
                    TextBoxAVG.Text = infobll[i].ZYJSPJZ;
                    //ZYJSXZ.Value = infobll[i].ZYJSXZ;
                }
            }
        }

        //悬架
        private void GetXJDate()
        {
            RESULT_SUSPENSION_BLL bll = new RESULT_SUSPENSION_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxQZXS.Text = infobll[i].QZZLXSLV_PD;
                    TextBoxQYXS.Text = infobll[i].QZYLXSLV_PD;
                    TextBoxHZXS.Text = infobll[i].HZZLXSLV_PD;
                    TextBoxHYXS.Text = infobll[i].HZYLXSLV_PD;
                    TextBoxQZXSC.Text = infobll[i].QZXSLVC_PD;
                    TextBoxHZXSC.Text = infobll[i].HZXSLVC_PD;
                }
            }
        }

        //其他
        private void GetQTData()
        {
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                //车速
                RESULT_SPEED_BLL CSbll = new RESULT_SPEED_BLL();
                var CSinfobll = CSbll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < CSinfobll.Length; i++)
                {
                    SDBZXX.Value = CSinfobll[i].SDBZXX;
                    SDBZSX.Value = CSinfobll[i].SDBZSX;
                    TextBoxCSB.Text = CSinfobll[i].SCSD;
                }
                //侧滑
                RESULT_SIDESLIP_BLL bll = new RESULT_SIDESLIP_BLL();
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBoxCH.Text = infobll[i].QQCHSCZ;
                    QQCHXZSX.Value = infobll[i].QQCHXZSX;
                    QQCHXZXX.Value = infobll[i].QQCHXZXX;
                }
                //声级
                RESULT_SPEAKER_BLL SJbll = new RESULT_SPEAKER_BLL();
                var SJinfobll = SJbll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < SJinfobll.Length; i++)
                {
                    SJXZXX.Value = SJinfobll[i].SJXZXX;
                    SJXZSX.Value = SJinfobll[i].SJXZSX;
                    TextBoxSJ.Text = SJinfobll[i].SCSJZ;
                }
            }

        }

        //底盘不合格项目
        private void GetDPBHGData()
        {
            RESULT_CHASISS_MANUAL_ZJ_BLL bll = new RESULT_CHASISS_MANUAL_ZJ_BLL();
            var lstJCLSH=GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var infobll = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < infobll.Length; i++)
                {
                    TextBox1.Text = infobll[i].RGJYBHGX;
                }
            }
        }
        #endregion

        #region 保存按钮
        protected void ButtonZD_Click(object sender, EventArgs e)
        {

            RESULT_BRAKE ZD = new RESULT_BRAKE();
            RESULT_BRAKE_BLL bll = new RESULT_BRAKE_BLL();

            ZD.YZZLZ = TextBox1lhL.Text;
            ZD.YZYLZ = TextBox1lhR.Text;
            ZD.YZZZDZDL = TextBox1zdlL.Text;
            ZD.YZYZDZDL = TextBox1zdlR.Text;
            ZD.YZZZDCZD = TextBox1gccL.Text;
            ZD.YZYZDCZD = TextBox1gccR.Text;
            ZD.YZZSZDL = TextBox1zcL.Text;
            ZD.YZYSZDL = TextBox1zcR.Text;
            ZD.YZZZZL = TextBox1zzlL.Text;
            ZD.YZYZZL = TextBox1zzlR.Text;
            ZD.YZZZZLV = TextBox1zzlvL.Text;
            ZD.YZYZZLV = TextBox1zzlvR.Text;
            ZD.YZBPHLV = TextBox1BPH.Text;
            ZD.YZZDLV = TextBox1ZDL.Text;

            ZD.EZZLZ = TextBox2lhL.Text;
            ZD.EZYLZ = TextBox2lhR.Text;
            ZD.EZZZDZDL = TextBox2zdlL.Text;
            ZD.EZYZDZDL = TextBox2zdlR.Text;
            ZD.EZZZDCZD = TextBox2gccL.Text;
            ZD.EZYZDCZD = TextBox2gccR.Text;
            ZD.EZZSZDL = TextBox2zcL.Text;
            ZD.EZYSZDL = TextBox2zcR.Text;
            ZD.EZZZZL = TextBox2zzlL.Text;
            ZD.EZYZZL = TextBox2zzlR.Text;
            ZD.EZZZZLV = TextBox2zzlvL.Text;
            ZD.EZYZZLV = TextBox2zzlvR.Text;
            ZD.EZBPHLV = TextBox2BPH.Text;
            ZD.EZZDLV = TextBox2ZDL.Text;

            ZD.SZZLZ = TextBox3lhL.Text;
            ZD.SZYLZ = TextBox3lhR.Text;
            ZD.SZZZDZDL = TextBox3zdlL.Text;
            ZD.SZYZDZDL = TextBox3zdlR.Text;
            ZD.SZZZDCZD = TextBox3gccL.Text;
            ZD.SZYZDCZD = TextBox3gccR.Text;
            ZD.SZZSZDL = TextBox3zcL.Text;
            ZD.SZYSZDL = TextBox3zcR.Text;
            ZD.SZZZZL = TextBox3zzlL.Text;
            ZD.SZYZZL = TextBox3zzlR.Text;
            ZD.SZZZZLV = TextBox3zzlvL.Text;
            ZD.SZYZZLV = TextBox3zzlvR.Text;
            ZD.SZBPHLV = TextBox3BPH.Text;
            ZD.SZZDLV = TextBox3ZDL.Text;

            ZD.SIZZLZ = TextBox4lhL.Text;
            ZD.SIZYLZ = TextBox4lhR.Text;
            ZD.SIZZZDZDL = TextBox4zdlL.Text;
            ZD.SIZYZDZDL = TextBox4zdlR.Text;
            ZD.SIZZZDCZD = TextBox4gccL.Text;
            ZD.SIZYZDCZD = TextBox4gccR.Text;
            ZD.SIZZSZDL = TextBox4zcL.Text;
            ZD.SIZYSZDL = TextBox4zcR.Text;
            ZD.SIZZZZL = TextBox4zzlL.Text;
            ZD.SIZYZZL = TextBox4zzlR.Text;
            ZD.SIZZZZLV = TextBox4zzlvL.Text;
            ZD.SIZYZZLV = TextBox4zzlvR.Text;
            ZD.SIZBPHLV = TextBox4BPH.Text;
            ZD.SIZZDLV = TextBox4ZDL.Text;

            ZD.WZZLZ = TextBox5lhL.Text;
            ZD.WZYLZ = TextBox5lhR.Text;
            ZD.WZZZDZDL = TextBox5zdlL.Text;
            ZD.WZYZDZDL = TextBox5zdlR.Text;
            ZD.WZZZDCZD = TextBox5gccL.Text;
            ZD.WZYZDCZD = TextBox5gccR.Text;
            ZD.WZZSZDL = TextBox5zcL.Text;
            ZD.WZYSZDL = TextBox5zcR.Text;
            ZD.WZZZZL = TextBox5zzlL.Text;
            ZD.WZYZZL = TextBox5zzlR.Text;
            ZD.WZZZZLV = TextBox5zzlvL.Text;
            ZD.WZYZZLV = TextBox5zzlvR.Text;
            ZD.WZBPHLV = TextBox5BPH.Text;
            ZD.WZZDLV = TextBox5ZDL.Text;

            ZD.LZZLZ = TextBox6lhL.Text;
            ZD.LZYLZ = TextBox6lhR.Text;
            ZD.LZZZDZDL = TextBox6zdlL.Text;
            ZD.LZYZDZDL = TextBox6zdlR.Text;
            ZD.LZZZDCZD = TextBox6gccL.Text;
            ZD.LZYZDCZD = TextBox6gccR.Text;
            ZD.LZZSZDL = TextBox6zcL.Text;
            ZD.LZYSZDL = TextBox6zcR.Text;
            ZD.LZZZZL = TextBox6zzlL.Text;
            ZD.LZYZZL = TextBox6zzlR.Text;
            ZD.LZZZZLV = TextBox6zzlvL.Text;
            ZD.LZYZZLV = TextBox6zzlvR.Text;
            ZD.LZBPHLV = TextBox6BPH.Text;
            ZD.LZZDLV = TextBox6ZDL.Text;

            ZD.ZCZZ = TextBoxZCLH.Text;
            ZD.EZSZDL = TextBoxZC.Text;
            ZD.ZCSZDLV = TextBoxZCZDL.Text;
            ZD.ZCZZ = TextBoxZHCLH.Text;
            ZD.ZCZDL = TextBoxZHC.Text; 
            ZD.ZCZDLV = TextBoxZHCZDL.Text;
            //根据所填数据更改判定结果

            #region 阻滞率判定

            if (TextBox1zzlvL.Text != "" && YzzlvBZ.Value != "")
            { 
             if (Convert.ToDouble(TextBox1zzlvL.Text) < Convert.ToDouble(YzzlvBZ.Value))
                ZD.YZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox1zzlvL.Text) > Convert.ToDouble(YzzlvBZ.Value))
                ZD.YZZZZL_PD = unqualified;
            else
                ZD.YZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox1zzlvR.Text) < Convert.ToDouble(YzzlvBZ.Value))
                ZD.YZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox1zzlvR.Text) > Convert.ToDouble(YzzlvBZ.Value))
                ZD.YZYZZL_PD = unqualified;
            else
                ZD.YZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox1zzlvL.Text) < Convert.ToDouble(YzzlvBZ.Value) && Convert.ToDouble(TextBox1zzlvR.Text) < Convert.ToDouble(YzzlvBZ.Value))
                ZD.YZZZL_PD = qualified;
            else
                ZD.YZZZL_PD = unqualified;
           
            }


            if (TextBox2zzlvL.Text != "" && EzzlvBZ.Value != "")
            { 
              if (Convert.ToDouble(TextBox2zzlvL.Text) < Convert.ToDouble(EzzlvBZ.Value))
                ZD.EZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox2zzlvL.Text) > Convert.ToDouble(EzzlvBZ.Value))
                ZD.EZZZZL_PD = unqualified;
            else
                ZD.EZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox2zzlvR.Text) < Convert.ToDouble(EzzlvBZ.Value))
                ZD.EZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox2zzlvR.Text) > Convert.ToDouble(EzzlvBZ.Value))
                ZD.EZYZZL_PD = unqualified;
            else
                ZD.EZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox2zzlvL.Text) < Convert.ToDouble(EzzlvBZ.Value) && Convert.ToDouble(TextBox2zzlvR.Text) < Convert.ToDouble(EzzlvBZ.Value))
                ZD.EZZZL_PD = qualified;
            else
                ZD.EZZZL_PD = unqualified;
                     
            }




            if (TextBox3zzlvL.Text != "" && SzzlvBZ.Value != "")
            { 
             if (Convert.ToDouble(TextBox3zzlvL.Text) < Convert.ToDouble(SzzlvBZ.Value))
                ZD.SZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox3zzlvL.Text) > Convert.ToDouble(SzzlvBZ.Value))
                ZD.SZZZZL_PD = unqualified;
            else
                ZD.SZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox3zzlvR.Text) < Convert.ToDouble(SzzlvBZ.Value))
                ZD.SZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox3zzlvR.Text) > Convert.ToDouble(SzzlvBZ.Value))
                ZD.SZYZZL_PD = unqualified;
            else
                ZD.SZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox3zzlvL.Text) < Convert.ToDouble(SzzlvBZ.Value) && Convert.ToDouble(TextBox3zzlvR.Text) < Convert.ToDouble(SzzlvBZ.Value))
                ZD.SZZZL_PD = qualified;
            else
                ZD.SZZZL_PD = unqualified;
            
            }



            if (TextBox4zzlvL.Text != "" && SIzzlvBZ.Value != "")
            {
            if (Convert.ToDouble(TextBox4zzlvL.Text) < Convert.ToDouble(SIzzlvBZ.Value))
                ZD.SIZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox4zzlvL.Text) > Convert.ToDouble(SIzzlvBZ.Value))
                ZD.SIZZZZL_PD = unqualified;
            else
                ZD.SIZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox4zzlvR.Text) < Convert.ToDouble(SIzzlvBZ.Value))
                ZD.SIZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox4zzlvR.Text) > Convert.ToDouble(SIzzlvBZ.Value))
                ZD.SIZYZZL_PD = unqualified;
            else
                ZD.SIZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox4zzlvL.Text) < Convert.ToDouble(SIzzlvBZ.Value) && Convert.ToDouble(TextBox4zzlvR.Text) < Convert.ToDouble(SIzzlvBZ.Value))
                ZD.SIZZZL_PD = qualified;
            else
                ZD.SIZZZL_PD = unqualified;

            }



            if (TextBox5zzlvL.Text != "" && WzzlvBZ.Value != "")
            {

            if (Convert.ToDouble(TextBox5zzlvL.Text) < Convert.ToDouble(WzzlvBZ.Value))
                ZD.WZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox5zzlvL.Text) > Convert.ToDouble(WzzlvBZ.Value))
                ZD.WZZZZL_PD = unqualified;
            else
                ZD.WZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox5zzlvR.Text) < Convert.ToDouble(WzzlvBZ.Value))
                ZD.WZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox5zzlvR.Text) > Convert.ToDouble(WzzlvBZ.Value))
                ZD.WZYZZL_PD = unqualified;
            else
                ZD.WZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox5zzlvL.Text) < Convert.ToDouble(WzzlvBZ.Value) && Convert.ToDouble(TextBox5zzlvR.Text) < Convert.ToDouble(WzzlvBZ.Value))
                ZD.WZZZL_PD = qualified;
            else
                ZD.WZZZL_PD = unqualified;


            }

            if (TextBox6zzlvL.Text != "" && LzzlvBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox6zzlvL.Text) < Convert.ToDouble(LzzlvBZ.Value))
                ZD.LZZZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox6zzlvL.Text) > Convert.ToDouble(LzzlvBZ.Value))
                ZD.LZZZZL_PD = unqualified;
            else
                ZD.LZZZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox6zzlvR.Text) < Convert.ToDouble(LzzlvBZ.Value))
                ZD.LZYZZL_PD = qualified;
            else if (Convert.ToDouble(TextBox6zzlvR.Text) > Convert.ToDouble(LzzlvBZ.Value))
                ZD.LZYZZL_PD = unqualified;
            else
                ZD.LZYZZL_PD = notdetected;
            if (Convert.ToDouble(TextBox6zzlvL.Text) < Convert.ToDouble(LzzlvBZ.Value) && Convert.ToDouble(TextBox6zzlvR.Text) < Convert.ToDouble(LzzlvBZ.Value))
                ZD.LZZZL_PD = qualified;
            else
                ZD.LZZZL_PD = unqualified;

            }


            
            #endregion 
            #region 不平衡率

            if (TextBox1BPH.Text != "" && YzbphBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox1BPH.Text) < Convert.ToDouble(YzbphBZ.Value))
                ZD.YZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox1BPH.Text) > Convert.ToDouble(YzbphBZ.Value))
                ZD.YZBPHLV_PD = unqualified;
            else
                ZD.YZBPHLV_PD = notdetected;

            }

            if (TextBox2BPH.Text != "" && EzbphBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox2BPH.Text) < Convert.ToDouble(EzbphBZ.Value))
                ZD.EZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox2BPH.Text) > Convert.ToDouble(EzbphBZ.Value))
                ZD.EZBPHLV_PD = unqualified;
            else
                ZD.EZBPHLV_PD = notdetected;
            }

            if (TextBox3BPH.Text != "" && SzbphBZ.Value != "")
            {
            if (Convert.ToDouble(TextBox3BPH.Text) < Convert.ToDouble(SzbphBZ.Value))
                ZD.SZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox3BPH.Text) > Convert.ToDouble(SzbphBZ.Value))
                ZD.SZBPHLV_PD = unqualified;
            else
                ZD.SZBPHLV_PD = notdetected;

            }


            if (TextBox4BPH.Text != "" && SIzbphBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox4BPH.Text) < Convert.ToDouble(SIzbphBZ.Value))
                ZD.SIZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox4BPH.Text) > Convert.ToDouble(SIzbphBZ.Value))
                ZD.SIZBPHLV_PD = unqualified;
            else
                ZD.SIZBPHLV_PD = notdetected;

            }



            if (TextBox5BPH.Text != "" && WzbphBZ.Value != "")
            {
            if (Convert.ToDouble(TextBox5BPH.Text) < Convert.ToDouble(WzbphBZ.Value))
                ZD.WZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox5BPH.Text) > Convert.ToDouble(WzbphBZ.Value))
                ZD.WZBPHLV_PD = unqualified;
            else
                ZD.WZBPHLV_PD = notdetected;

            }

            if (TextBox6BPH.Text != "" && LzbphBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox6BPH.Text) < Convert.ToDouble(LzbphBZ.Value))
                ZD.LZBPHLV_PD = qualified;
            else if (Convert.ToDouble(TextBox6BPH.Text) > Convert.ToDouble(LzbphBZ.Value))
                ZD.LZBPHLV_PD = unqualified;
            else
                ZD.LZBPHLV_PD = notdetected;
            }
           

          





            #endregion
            #region 制动率

            if (TextBox1ZDL.Text != "" && YzzdlvBZ.Value != "")
            {
             if (Convert.ToDouble(TextBox1ZDL.Text) > Convert.ToDouble(YzzdlvBZ.Value))
                ZD.YZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox1ZDL.Text) < Convert.ToDouble(YzzdlvBZ.Value))
                ZD.YZZDLV_PD = unqualified;
            else
                ZD.YZZDLV_PD = notdetected;
            }

            if (TextBox2ZDL.Text != "" && EzzdlvBZ.Value != "")
            { 
             if (Convert.ToDouble(TextBox2ZDL.Text) > Convert.ToDouble(EzzdlvBZ.Value))
                ZD.EZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox2ZDL.Text) < Convert.ToDouble(EzzdlvBZ.Value))
                ZD.EZZDLV_PD = unqualified;
            else
                ZD.EZZDLV_PD = notdetected;          
            }

            if (TextBox3ZDL.Text != "" && SzzdlvBZ.Value != "")
            {
          if (Convert.ToDouble(TextBox3ZDL.Text) > Convert.ToDouble(SzzdlvBZ.Value))
                ZD.SZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox3ZDL.Text) < Convert.ToDouble(SzzdlvBZ.Value))
                ZD.SZZDLV_PD = unqualified;
            else
                ZD.SZZDLV_PD = notdetected;


            }

            if (TextBox4ZDL.Text != "" && SIzzdlvBZ.Value != "")
            {
if (Convert.ToDouble(TextBox4ZDL.Text) > Convert.ToDouble(SIzzdlvBZ.Value))
                ZD.SIZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox4ZDL.Text) < Convert.ToDouble(SIzzdlvBZ.Value))
                ZD.SIZZDLV_PD = unqualified;
            else
                ZD.SIZZDLV_PD = notdetected;
            }

           
            if (TextBox5ZDL.Text != "" && WzzdlvBZ.Value != "")
            {
            if (Convert.ToDouble(TextBox5ZDL.Text) > Convert.ToDouble(WzzdlvBZ.Value))
                ZD.WZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox5ZDL.Text) < Convert.ToDouble(WzzdlvBZ.Value))
                ZD.WZZDLV_PD = unqualified;
            else
                ZD.WZZDLV_PD = notdetected;
            }

            if (TextBox6ZDL.Text != "" && LzzdlvBZ.Value != "")
            {
           if (Convert.ToDouble(TextBox6ZDL.Text) > Convert.ToDouble(LzzdlvBZ.Value))
                ZD.LZZDLV_PD = qualified;
            if (Convert.ToDouble(TextBox6ZDL.Text) < Convert.ToDouble(LzzdlvBZ.Value))
                ZD.LZZDLV_PD = unqualified;
            else
                ZD.LZZDLV_PD = notdetected;
            }
            

           
            #endregion

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(ZD,jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelZD, "保存成功！");
            }
            else
            {
                ZD.JCLSH = jclsh;
                bll.Insert(ZD);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelZD, "保存成功！!");
            }
        }

        protected void ButtonXX_Click(object sender, EventArgs e)
        {
            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            RESULT_VEHICLE_INFO JBXX = new RESULT_VEHICLE_INFO();

            JBXX.SYR = TextBoxCZDW.Text;
            JBXX.FDJH = TextBoxFDJH.Text;
            JBXX.CLZL = TextBoxCLLB.Text;
            JBXX.HDZH = TextBoxZZL.Text;
            JBXX.CYS = TextBoxZWS.Text;
            JBXX.SJDW = TextBoxSJDW.Text;
            JBXX.YYZH = TextBoxYYZH.Text;
            JBXX.VIN = TextBoxCJHM.Text;
            JBXX.PP = TextBoxCP.Text;
            JBXX.XH = TextBoxXH.Text;

            JBXX.CCDJRQ = TextBoxRHRQ.Text;
            JBXX.JCRQ = TextBoxCJRQ.Text;
            JBXX.RLLB = TextBoxRL.Text;
            JBXX.YCY = TextBoxJYY1.Text;
            JBXX.DLY = TextBoxJYY2.Text;
            JBXX.DPJYY = TextBoxDPRY.Text;

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(JBXX, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelJBXX, "保存成功！");
            }
            else
            {
                JBXX.JCLSH = jclsh;
                bll.Insert(JBXX);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelJBXX, "保存成功！!");
            }

        }

        protected void ButtonPLUS_Click(object sender, EventArgs e)
        {
            RESULT_VEHICLE_INFO_BLL bll = new RESULT_VEHICLE_INFO_BLL();
            RESULT_VEHICLE_INFO PLUS = new RESULT_VEHICLE_INFO();
            //Line 1
            PLUS.HPHM = TextBoxHPHM.Text;
            PLUS.HPZL = drpHPZL.SelectedItem.Text;
            PLUS.HPZLDH = drpHPZL.SelectedValue;
            PLUS.GCPZH = TextBoxGCPZH.Text;
            PLUS.CCRQ = TextBoxCLCCRQ.Text;
            //Line 2
            PLUS.CCDJRQ = TextBoxZCDJRQ.Text;
            PLUS.VIN = TextBoxVIN.Text;
            PLUS.XH = TextBoxCLXH.Text;
            PLUS.FDJH = TextBoxFDJH.Text;
            PLUS.CSYS = drpCSYS.SelectedItem.Text;
            //+RESULT_VEHICLE_INFO HASN'T CSYSDH FIELD
            //Line 3
            PLUS.LJXSLC = TextBoxXSLC.Text;
            PLUS.QDXS = drpQDXS.SelectedItem.Text;
            PLUS.QDXSDH = drpQDXS.SelectedValue;
            PLUS.ZXZXJXS = drpZXZXJXS.SelectedItem.Text;
            PLUS.ZXZXJXSDH = drpZXZXJXS.SelectedValue;
            PLUS.ZZS = TextBoxGCZS.Text;
            PLUS.EDGL = TextBoxYRGL.Text;
            //Line 4
            PLUS.EDNJ = TextBoxNJ.Text;
            PLUS.EDNJZS = TextBoxZS.Text;
            PLUS.RLLB = drpRLLB.SelectedItem.Text;
            PLUS.RLLBDH = drpRLLB.SelectedValue;
            PLUS.LTGGLX = drpLTGGLX.SelectedItem.Text;
            PLUS.LTGGLXDH = drpLTGGLX.SelectedValue;
            PLUS.ZZL = TextBoxCZZL.Text;
            PLUS.CSG = TextBoxCLCG.Text;
            //Line 5
            PLUS.LZLJ = TextBoxQLJ.Text;
            PLUS.CSC = TextBoxKCCC.Text;
            PLUS.KCLXDJ = drpKCLXDJ.SelectedItem.Text;
            //+RESULT_VEHICLE_INFO HASN'T KCLXDJDH FIELD
            PLUS.HCCSXS = TextBoxHCCS.Text;
            PLUS.QDZWZ = TextBoxQDZS.Text;
            //Line 6
            PLUS.QDZKZZL = TextBoxQDZL.Text;
            PLUS.ZBZL = TextBoxQYZL.Text;
            PLUS.BZZXS = drpBZZXS.SelectedItem.Text;
            PLUS.BZZXSDH = drpBZZXS.SelectedValue;
            PLUS.ZXZLXDH = TextBoxZXZS.Text;
            PLUS.QZDZ = drpQZDZ.SelectedItem.Text;
            PLUS.QZDZDH = drpQZDZ.SelectedValue;
            //Line 7
            PLUS.CYS = TextBoxKCZW.Text;
            PLUS.ZZS = TextBoxDCZS.Text;
            PLUS.CSC = TextBoxDC1.Text;
            PLUS.CSK = TextBoxDC2.Text;
            PLUS.CSG = TextBoxDC3.Text;
            PLUS.GCCSC = TextBoxGC1.Text;
            PLUS.GCCSK = TextBoxGC2.Text;
            PLUS.GCCSG = TextBoxGC3.Text;
            //Line 8
            PLUS.YGGSNFKT = drpYGGSNFKT.SelectedItem.Text;
            PLUS.YGGSNFKTDH = drpYGGSNFKT.SelectedValue;
            string zczwz = TextBoxZCZ.Text;
            if (!string.IsNullOrEmpty(zczwz))
            {
                if (zczwz.Substring(zczwz.Length - 1, 1) != ",")
                {
                    zczwz += ",";
                }
            }
            PLUS.ZCZWZ = zczwz;
            PLUS.ZCLBGD = TextBoxCXLBGDDC.Text;
            PLUS.GCLBGD = TextBoxCXLBGDGC.Text;

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(PLUS, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelJBXX, "保存成功！");
            }
            else
            {
                PLUS.JCLSH = jclsh;
                bll.Insert(PLUS);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelJBXX, "保存成功！!");
            }

        }

        protected void ButtonDPCG_Click(object sender, EventArgs e)
        {
            RESULT_DPCG DPCG = new RESULT_DPCG();
            RESULT_DPCG_BLL bll = new RESULT_DPCG_BLL();
            DPCG.NJGL_SCBZ = TextBoxNJGK.Text;
            DPCG.GLGL_SCBZ = TextBoxGLGK.Text;
            DPCG.HX_LC = TextBoxHX.Text;

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(DPCG, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPCG, "保存成功！");
            }
            else
            {
                DPCG.JCLSH = jclsh;
                bll.Insert(DPCG);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPCG, "保存成功！!");
            }
        }

        protected void ButtonDLX_Click(object sender, EventArgs e)
        {
            RESULT_DPCG DPCG = new RESULT_DPCG();
            RESULT_DPCG_BLL bll = new RESULT_DPCG_BLL();
            DPCG.GK_DBGL = TextBoxDBGL.Text;
            DPCG.GK_EDCS = TextBoxEDCS.Text;
            DPCG.GK_JZL = TextBoxJZL.Text;
            DPCG.GK_WDCS = TextBoxWDCS.Text;
            if (rblDLX.SelectedValue == "1")
            {
                DPCG.GK_PD = "1";
            }
            else
            {
                DPCG.GK_PD = "2";
            }
            int count=bll.GetModelList("jclsh='" + jclsh + "'").Count();

            if (count>0)
            {
                bll.Update(DPCG, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPCG, "保存成功!");
            }
            else
            {
                DPCG.JCLSH = jclsh;
                bll.Insert(DPCG);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPCG, "保存成功！!");
            }
        }

        protected void ButtonRYJJ_Click(object sender, EventArgs e)
        {
            RESULT_DPCG DPCG = new RESULT_DPCG();
            RESULT_DPCG_BLL bll = new RESULT_DPCG_BLL();
            DPCG.YH_BZ = TextBoxRYJJ1.Text;
            DPCG.YH_SCZ = TextBoxRYJJ2.Text;
            if (rblRYJJ.SelectedValue == "1")
            {
                DPCG.YH_PD = "1";
            }
            else
            {
                DPCG.YH_PD = "2";
            }
            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(DPCG, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！");
            }
            else
            {
                DPCG.JCLSH = jclsh;
                bll.Insert(DPCG);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！!");

            }

        }

        protected void ButtonSDS_Click(object sender, EventArgs e)
        {
            RESULT_SDS SDS = new RESULT_SDS();
            RESULT_SDS_BLL bll = new RESULT_SDS_BLL();
            SDS.DSCO = TextBoxDSCO.Text;
            SDS.DSHC = TextBoxDSHC.Text;
            SDS.GDSCO = TextBoxGDSCO.Text;
            SDS.GDSHC = TextBoxGDSHC.Text;
            SDS.GLKQXS = TextBoxGDSGKL.Text;
            if (rblSDS.SelectedValue == "1")
            {
                SDS.SDS_PD = "1";
            }
            else
            {
                SDS.SDS_PD = "2";
            }
            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(SDS, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！");
            }
            else
            {
                SDS.JCLSH = jclsh;
                bll.Insert(SDS);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！!");

            }
            
        }

        protected void ButtonWTGK_Click(object sender, EventArgs e)
        {
            RESULT_ASM ASM = new RESULT_ASM();
            RESULT_ASM_BLL bll = new RESULT_ASM_BLL();
            ASM.CO5025JG = TextBoxWTGK1.Text;
            ASM.HC5025JG = TextBoxWTGK2.Text;
            ASM.NO5025JG = TextBoxWTGK3.Text;
            ASM.CO2540JG = TextBoxWTGK4.Text;
            ASM.HC2540JG = TextBoxWTGK5.Text;
            ASM.NO2540JG = TextBoxWTGK6.Text;
            if (rblWTGK.SelectedValue == "1")
            {
                ASM.ASM_PD = "1";
            }
            else
            {
                ASM.ASM_PD = "2";
            }
            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(ASM, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！");
            }
            else
            {
                ASM.JCLSH = jclsh;
                bll.Insert(ASM);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！!");
            }

        }

        protected void ButtonSTGK_Click(object sender, EventArgs e)
        {
            RESULT_VMAS VMAS = new RESULT_VMAS();
            RESULT_VMAS_BLL bll = new RESULT_VMAS_BLL();
            VMAS.COJG = TextBoxSTGK1.Text;
            VMAS.HCJG = TextBoxSTGK2.Text;
            VMAS.NOJG = TextBoxSTGK3.Text;
            VMAS.HC_NOJG = TextBoxSTGK4.Text;
            if (rblSTGK.SelectedValue == "1")
            {
                VMAS.VMAS_PD = "1";
            }
            else
            {
                VMAS.VMAS_PD = "2";
            }
            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(VMAS, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！");
            }
            else
            {
                VMAS.JCLSH = jclsh;
                bll.Insert(VMAS);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！!");

            }

        }

        protected void ButtonGXS_Click(object sender, EventArgs e)
        {
            RESULT_LD LD = new RESULT_LD();
            RESULT_LD_BLL bll = new RESULT_LD_BLL();
            LD.GXSXS80 = TextBoxGXS1.Text;
            LD.GXSXS90 = TextBoxGXS2.Text;
            LD.GXSXS100 = TextBoxGXS3.Text;
            LD.GLJG = TextBoxGXS4.Text;
            if (rblGXS.SelectedValue == "1")
            {
                LD.LD_PD = "1";
            }
            else
            {
                LD.LD_PD = "2";
            }
            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(LD, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！");
            }
            else
            {
                LD.JCLSH = jclsh;
                bll.Insert(LD);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelSDS, "保存成功！!");

            }

        }

        protected void ButtonZYJS_Click(object sender, EventArgs e)
        {
            RESULT_ZYJS ZYJS = new RESULT_ZYJS();
            RESULT_ZYJS_BLL bll = new RESULT_ZYJS_BLL();

            ZYJSXZ.Value = "3.0";
            ZYJS.ZYJSJG1 = TextBoxONE.Text;
            ZYJS.ZYJSJG2 = TextBoxTWO.Text;
            ZYJS.ZYJSJG3 = TextBoxTHREE.Text;
            ZYJS.ZYJSPJZ = TextBoxAVG.Text;
            if (TextBoxAVG.Text != "" && ZYJSXZ.Value != "")
            {
                if (double.Parse(TextBoxAVG.Text) <double.Parse(ZYJSXZ.Value))
                    ZYJS.ZYJS_PD = qualified;
                else if (double.Parse(TextBoxAVG.Text) > double.Parse(ZYJSXZ.Value))
                    ZYJS.ZYJS_PD = unqualified;
                else
                    ZYJS.ZYJS_PD = notdetected;
            }
            int count=bll.GetModelList("jclsh='"+jclsh+"'").Count();
            if (count > 0)
            {
                bll.Update(ZYJS, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelZYJS, "保存成功！");
            }
            else
            {
                ZYJS.JCLSH = jclsh;
                bll.Insert(ZYJS);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelZYJS, "修改成功!！");
            }

            

        }

        protected void ButtonDG_Click(object sender, EventArgs e)
        {
            RESULT_LAMP_ZJ LAMP = new RESULT_LAMP_ZJ();
            RESULT_LAMP_ZJ_BLL bll = new RESULT_LAMP_ZJ_BLL();

            LAMP.ZWDYGGQ = TextBoxZWGQ.Text;
            LAMP.YWDYGGQ = TextBoxYWGQ.Text;
            LAMP.ZNDYGGQ = TextBoxZNGQ.Text;
            LAMP.YNDYGGQ = TextBoxYNGQ.Text;
            LAMP.ZWDJGCZPY = TextBoxJGZWSX.Text;
            LAMP.YWDJGCZPY = TextBoxJGYWSX.Text;
            LAMP.ZWDJGSPPYL = TextBoxJGZYSP.Text;
            LAMP.YWDJGSPPYL = TextBoxJGYWSP.Text;
            LAMP.ZNDJGSPPYL = TextBoxJGZNSP.Text;
            LAMP.YNDJGSPPYL = TextBoxJGYNSP.Text;

            LAMP.ZWDYGCZPY = TextBoxYGZWSX.Text;
            LAMP.YWDYGCZPY = TextBoxYGYWSX.Text;
            LAMP.ZWDYGSPPYL = TextBoxYGZWSP.Text;
            LAMP.YWDYGSPPYL = TextBoxYGYWSP.Text;
            LAMP.ZNDYGSPPY = TextBoxYGZNSP.Text;
            LAMP.YNDYGSPPY = TextBoxYGYNSP.Text;

            LAMP.ZWDZ_PD = TextBoxZWPD.Text;
            LAMP.YWDZ_PD = TextBoxYWPD.Text;
            LAMP.ZNDZ_PD = TextBoxZNPD.Text;
            LAMP.YNDZ_PD = TextBoxYNPD.Text;
            LAMP.DGZGQ_PD = TextBoxGQPD.Text;

            #region 灯光强度判定
            string dgzgqxz = "";
            var lstJCLSH = GetAllJCLSH(jclsh);
            for (int j = 0; j < lstJCLSH.Count; j++)
            {
                var stand = bll.GetModelList("JCLSH= '" + lstJCLSH[j] + "'");
                for (int i = 0; i < stand.Length; i++)
                {
                    dgzgqxz = stand[i].DGGQXZ;
                }
            }
            if (!string.IsNullOrEmpty(LAMP.ZWDYGGQ) && LAMP.ZWDYGGQ != "-")
            {
                if (double.Parse(LAMP.ZWDYGGQ) >= double.Parse(dgzgqxz))
                {
                    LAMP.ZWDYGGQ_PD = "1";
                }
                else
                {
                    LAMP.ZWDYGGQ_PD = "2";
                }
            }
            if (!string.IsNullOrEmpty(LAMP.YWDYGGQ) && LAMP.YWDYGGQ != "-")
            {
                if (double.Parse(LAMP.YWDYGGQ) >= double.Parse(dgzgqxz))
                {
                    LAMP.YWDYGGQ_PD = "1";
                }
                else
                {
                    LAMP.YWDYGGQ_PD = "2";
                }
            }
            if (!string.IsNullOrEmpty(LAMP.ZNDYGGQ) && LAMP.ZNDYGGQ != "-")
            {
                if (double.Parse(LAMP.ZNDYGGQ) >= double.Parse(dgzgqxz))
                {
                    LAMP.ZNDYGGQ_PD = "1";
                }
                else
                {
                    LAMP.ZNDYGGQ_PD = "2";
                }
            }
            if (!string.IsNullOrEmpty(LAMP.YNDYGGQ) && LAMP.YNDYGGQ != "-")
            {
                if (double.Parse(LAMP.YNDYGGQ) >= double.Parse(dgzgqxz))
                {
                    LAMP.YNDYGGQ_PD = "1";
                }
                else
                {
                    LAMP.YNDYGGQ_PD = "2";
                }
            }
            
            
            
            
            #endregion

            #region 灯光偏移判定
            string jgzwsx=TextBoxJGZWSX.Text.Trim();
            if (!string.IsNullOrEmpty(jgzwsx))
            {
                LAMP.ZWDJGCZPY_PD = getJGCZPD(jgzwsx);
            }
            string jgzwsp = TextBoxJGZYSP.Text.Trim();
            if (!string.IsNullOrEmpty(jgzwsp))
            {
                LAMP.ZWDJGSPPY_PD = getdgPD(jgzwsp);
            }
            string ygzwsx = TextBoxYGZWSX.Text.Trim();
            if (!string.IsNullOrEmpty(ygzwsx))
            {
                LAMP.ZWDYGCZPY_PD = getYGCZPD(ygzwsx);
            }
            string ygzwsp = TextBoxYGZWSP.Text.Trim();
            if (!string.IsNullOrEmpty(ygzwsp))
            {
                LAMP.ZWDYGSPPY_PD = getdgPD(ygzwsp);
            }
            string jgywsx = TextBoxJGYWSX.Text.Trim();
            if (!string.IsNullOrEmpty(jgywsx))
            {
                LAMP.YWDJGCZPY_PD = getJGCZPD(jgywsx);
            }
            string jgywsp = TextBoxJGYWSP.Text.Trim();
            if (!string.IsNullOrEmpty(jgywsp))
            {
                LAMP.YWDJGSPPY_PD = getdgPD(jgywsp);
            }
            string ygywsx = TextBoxYGYWSX.Text.Trim();
            if (!string.IsNullOrEmpty(ygywsx))
            {
                LAMP.YWDYGCZPY_PD = getYGCZPD(ygywsx);
            }
            string ygywsp= TextBoxYGYWSP.Text.Trim();
            if (!string.IsNullOrEmpty(ygywsp) && ygywsp != "-" && double.Parse(ygywsp) >= -350 && double.Parse(ygywsp) <= 350)
            {
                LAMP.YWDYGSPPY_PD = "1";
            }
            else
            {
                LAMP.YWDYGSPPY_PD = "2";
            }
            string jgznsp = TextBoxJGZNSP.Text.Trim();
            if (!string.IsNullOrEmpty(jgznsp))
            {
                LAMP.ZNDJGSPPY_PD = getdgPD(jgznsp);
            }
            string ygznsp = TextBoxYGZNSP.Text.Trim();
            if (!string.IsNullOrEmpty(ygznsp))
            {
                LAMP.ZNDYGSPPY_PD = getdgPD(ygznsp);
            }
            string jgynsp = TextBoxJGYNSP.Text.Trim();
            if (!string.IsNullOrEmpty(jgynsp))
            {
                LAMP.YNDJGSPPY_PD = getdgPD(jgynsp);
            }
            string ygynsp = TextBoxYGYNSP.Text.Trim();
            if (!string.IsNullOrEmpty(ygynsp) && ygynsp != "-" && double.Parse(ygynsp) >= -350 && double.Parse(ygynsp) <= 350)
            {
                LAMP.YNDYGSPPY_PD = "1";
            }
            else
            {
                LAMP.YNDYGSPPY_PD = "2";
            }

            #endregion

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(LAMP, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDG, "保存成功！");
            }
            else
            {
                LAMP.JCLSH = jclsh;
                bll.Insert(LAMP);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDG, "保存成功！!");
            }
            
        }

        protected void ButtonDPBHGX_Click(object sender, EventArgs e)
        {
            RESULT_CHASISS_MANUAL_ZJ MANUAL = new RESULT_CHASISS_MANUAL_ZJ();
            RESULT_CHASISS_MANUAL_ZJ_BLL bll = new RESULT_CHASISS_MANUAL_ZJ_BLL();

            MANUAL.RGJYBHGX = TextBox1.Text;

            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(MANUAL, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPBHGX, "保存成功！");
            }
            else
            {
                MANUAL.JCLSH = jclsh;
                //bll.Insert(MANUAL);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPBHGX, "保存成功！!");

            }
        }

        protected void ButtonXJ_Click(object sender, EventArgs e)
        {
            RESULT_SUSPENSION XJ = new RESULT_SUSPENSION();
            RESULT_SUSPENSION_BLL bll = new RESULT_SUSPENSION_BLL();
            XJ.QZZLXSLV = TextBoxQZXS.Text;
            XJ.QZYLXSLV = TextBoxQYXS.Text;
            XJ.HZZLXSLV= TextBoxHZXS.Text;
            XJ.HZYLXSLV = TextBoxHYXS.Text;
            XJ.QZXSLVC = TextBoxQZXSC.Text;
            XJ.HZXSLVC = TextBoxHZXSC.Text;
            if (rblXJQZ.SelectedValue == "1")
            {
                XJ.QZ_PD = "1";
            }
            else
            {
                XJ.QZ_PD = "2";
            }
            if (rblXJHZ.SelectedValue == "1")
            {
                XJ.HZ_PD = "1";
            }
            else
            {
                XJ.HZ_PD = "2";
            }


            int count = bll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                bll.Update(XJ, jclsh);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelXJ, "保存成功！");
            }
            else
            {
                XJ.JCLSH = jclsh;
                bll.Insert(XJ);
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelXJ, "保存成功！!");
            }
            

        }

        protected void ButtonQT_Click(object sender, EventArgs e)
        {
            RESULT_SPEED CS = new RESULT_SPEED();
            RESULT_SPEED_BLL CSbll = new RESULT_SPEED_BLL();
            CS.SCSD = TextBoxCSB.Text;
            if (!string.IsNullOrEmpty(CS.SCSD))
            {
                if (double.Parse(CS.SCSD) >= 32.8 && double.Parse(CS.SCSD) <= 40.0)
                {
                    CS.SD_PD = "1";
                }
                else
                {
                    CS.SD_PD = "2";
                }
            }
            int count = CSbll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {
                CSbll.Update(CS, jclsh);
            }
            else
            {
                CS.JCLSH = jclsh;
                CSbll.Insert(CS);
            }
            


            RESULT_SIDESLIP CH = new RESULT_SIDESLIP();
            RESULT_SIDESLIP_BLL bll = new RESULT_SIDESLIP_BLL();
            CH.QQCHSCZ = TextBoxCH.Text;
            bll.Update(CH, jclsh);


            RESULT_SPEAKER SJ = new RESULT_SPEAKER();
            RESULT_SPEAKER_BLL SJbll = new RESULT_SPEAKER_BLL();
            SJ.SCSJZ = TextBoxSJ.Text;
            if (!string.IsNullOrEmpty(SJ.SCSJZ))
            {
                if (int.Parse(SJ.SCSJZ) <= 115 && int.Parse(SJ.SCSJZ) >= 90)
                {
                    SJ.SJZ_PD = "1";
                }
                else
                {
                    SJ.SJZ_PD = "2";
                }
            }
            int countsj = SJbll.GetModelList("jclsh='" + jclsh + "'").Count();
            if (countsj > 0)
            {
                SJbll.Update(SJ, jclsh);
            }
            else
            {
                SJ.JCLSH = jclsh;
                SJbll.Insert(SJ);
            }
        }

        protected void ButtonTP_Click(object sender, EventArgs e)
        {
            
  
            
            RESULT_IMAGE_BLL IMAGEBLL = new RESULT_IMAGE_BLL();
           
            HttpPostedFile upPhoto = File.PostedFile;
            int upPhotoLength = upPhoto.ContentLength;
            byte[] a = new Byte[upPhotoLength];
            Stream PhotoStream = upPhoto.InputStream;
            PhotoStream.Read(a, 0, upPhotoLength);
            
            
            HttpPostedFile upPhoto1 = File1.PostedFile;
            int upPhotoLength1 = upPhoto1.ContentLength;
            byte[] b  = new Byte[upPhotoLength1];
            Stream PhotoStream1 = upPhoto1.InputStream;
            PhotoStream1.Read(b, 0, upPhotoLength1);

            HttpPostedFile upPhoto2 = File2.PostedFile;
            int upPhotoLength2 = upPhoto2.ContentLength;
            byte[] c = new Byte[upPhotoLength2];
            Stream PhotoStream2 = upPhoto2.InputStream;
            PhotoStream2.Read(c, 0, upPhotoLength2);
            
            
            
            int count = IMAGEBLL.GetModelList("jclsh='" + jclsh + "'").Count();
            if (count > 0)
            {              
           
                SqlConnection conn = new SqlConnection(AppConfig.g_strConnectionStringSqlClient);
                string strsql = "update RESULT_IMAGE set Lamp_Image=@Lamp_Image , Brake_Image=@Brake_Image , Power_Image=@Power_Image WHERE JCLSH='"+jclsh+"'";
                SqlCommand cmd = new SqlCommand(strsql, conn);
                cmd.Parameters.Add("@Lamp_Image", SqlDbType.Image);
                cmd.Parameters.Add("@Brake_Image", SqlDbType.Image);
                cmd.Parameters.Add("@Power_Image", SqlDbType.Image);
                cmd.Parameters["@Lamp_Image"].Value = a;
                cmd.Parameters["@Brake_Image"].Value = b;
                cmd.Parameters["@Power_Image"].Value = c;
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPBHGX, "保存成功！");
            }
            else
            {
                SqlConnection conn = new SqlConnection(AppConfig.g_strConnectionStringSqlClient);
                string strsql = "insert into RESULT_IMAGE(JCLSH,Lamp_Image,Brake_Image,Power_Image) values(@JCLSH,@Lamp_Image,@Brake_Image,@Power_Image)";
                SqlCommand cmd = new SqlCommand(strsql, conn);
                cmd.Parameters.Add("@Lamp_Image", SqlDbType.Image);
                cmd.Parameters.Add("@Brake_Image", SqlDbType.Image);
                cmd.Parameters.Add("@Power_Image", SqlDbType.Image);
                cmd.Parameters.Add("@JCLSH", SqlDbType.VarChar);
                cmd.Parameters["@Lamp_Image"].Value = a;
                cmd.Parameters["@Brake_Image"].Value = b;
                cmd.Parameters["@Power_Image"].Value = c;
                cmd.Parameters["@JCLSH"].Value = jclsh;
                conn.Open();
                cmd.ExecuteNonQuery();
                conn.Close();
                gfLibrary.gfAjaxJs.SetAlertMsg(this.UpdatePanelDPBHGX, "保存成功！");
            }


















        }


        #endregion

        #region 返回按钮
        protected void ButtonXXFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");    
        }
        protected void ButtonPLUSFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonZDFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonDPCGFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonDLXFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonRYJJFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonSDSFH_Click(object sender, EventArgs e)
         {
             Response.Redirect("PrintZJList.aspx");
         }
        protected void ButtonWTGKFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonSTGKFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonGXSFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonZYJSFH_Click(object sender, EventArgs e)
         {
             Response.Redirect("PrintZJList.aspx");
         }
        protected void ButtonDGFH_Click(object sender, EventArgs e)
         {
             Response.Redirect("PrintZJList.aspx");
         }
        protected void ButtonXJFH_Click(object sender, EventArgs e)
         {
             Response.Redirect("PrintZJList.aspx");
         }
        protected void ButtonQTFH_Click(object sender, EventArgs e)
         {
             Response.Redirect("PrintZJList.aspx");
         }
        protected void ButtonDPBHGXFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        protected void ButtonTPFH_Click(object sender, EventArgs e)
        {
            Response.Redirect("PrintZJList.aspx");
        }
        #endregion

        #region 判定方法
        protected string getdgPD(string value)
        {
            string result = "";
            if (value != "-")
            {
                if (double.Parse(value) >= -350 && double.Parse(value) <= 170)
                {
                    result = "1";
                }
                else
                {
                    result = "2";
                }
            }
            return result;
        }
        protected string getJGCZPD(string value)
        {
            string result="";
            RESULT_LAMP_ZJ LAMP = new RESULT_LAMP_ZJ();
            RESULT_LAMP_ZJ_BLL bll = new RESULT_LAMP_ZJ_BLL();
            if (!string.IsNullOrEmpty(jclsh))
            {
                LAMP = bll.GetModel(jclsh);
            }
            if (float.Parse(value) >= float.Parse(LAMP.JGCZPYXZXX) && float.Parse(value) <= float.Parse(LAMP.JGCZPYXZSX))
            {
                result = "1";
            }
            else
            {
                result = "2";
            }
            return result;
        }
        protected string getYGCZPD(string value)
        {
            string result = "";
            RESULT_LAMP_ZJ LAMP = new RESULT_LAMP_ZJ();
            RESULT_LAMP_ZJ_BLL bll = new RESULT_LAMP_ZJ_BLL();
            if (!string.IsNullOrEmpty(jclsh))
            {
                LAMP = bll.GetModel(jclsh);
            }
            if (float.Parse(value) >= float.Parse(LAMP.YGCZPYXZXX) && float.Parse(value) <= float.Parse(LAMP.YGCZPYXZSX))
            {
                result = "1";
            }
            else
            {
                result = "2";
            }
            return result;
        }
        #endregion

    }
}